home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 25 / CU Amiga Magazine's Super CD-ROM 25 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-08].iso / CUCD / Programming / EasyPLUGINs / examples / bar_demo.e next >
Encoding:
Text File  |  1998-04-10  |  2.3 KB  |  90 lines

  1.  
  2. /*
  3.  
  4. */
  5.  
  6. OPT PREPROCESS, OSVERSION=37
  7.  
  8. MODULE 'tools/easygui', 'easyplugins/bar',
  9.        'utility', 'utility/tagitem'
  10.  
  11. DEF bar_1:PTR TO bar_plugin,
  12.     bar_2:PTR TO bar_plugin,
  13.     bar_3:PTR TO bar_plugin,
  14.     bar_4:PTR TO bar_plugin,
  15.     work[64]:STRING,
  16.     t1:PTR TO LONG, t2:PTR TO LONG,
  17.     t3:PTR TO LONG, t4:PTR TO LONG
  18.  
  19. PROC main() HANDLE
  20.  
  21.     IF (utilitybase:=OpenLibrary('utility.library', 37))=NIL THEN Raise("utlb")
  22.  
  23.     Rnd(-VbeamPos())
  24.  
  25.     NEW bar_1.bar([PLA_Bar_Percent,   100,
  26.                    TAG_DONE]),
  27.         bar_2.bar([PLA_Bar_Percent,   30,
  28.                    TAG_DONE]),
  29.         bar_3.bar([PLA_Bar_Percent,   100,
  30.                    PLA_Bar_Vertical,  TRUE,
  31.                    TAG_DONE]),
  32.         bar_4.bar([PLA_Bar_Percent,   65,
  33.                    PLA_Bar_Vertical,  TRUE,
  34.                    TAG_DONE])
  35.  
  36.     easyguiA('bar_plugin example', [ROWS,
  37.                                        [SPACEV], [PLUGIN, 1, bar_1], [SPACEV], t1:=[TEXT, '100%', NIL, TRUE, 1],
  38.                                        [SPACEV], [PLUGIN, 1, bar_2], [SPACEV], t2:=[TEXT, '30%', NIL, TRUE, 1],
  39.                                        [SPACEV],
  40.                                        [EQCOLS,
  41.                                             [ROWS, [PLUGIN, 1, bar_3], t3:=[TEXT, '100%', NIL, TRUE, 1]],
  42.                                             [ROWS, [PLUGIN, 1, bar_4], t4:=[TEXT, '65%', NIL, TRUE, 1]]
  43.                                        ],
  44.                                        [SPACEV],
  45.                                        [EQCOLS,
  46.                                            [SBUTTON, {random}, 'Random'],
  47.                                            [SPACEH],
  48.                                            [SBUTTON, NIL, 'Quit']
  49.                                        ]
  50.                                    ])
  51.  
  52. EXCEPT DO
  53.  
  54.     END bar_1, bar_2, bar_3, bar_4
  55.  
  56.     IF utilitybase THEN CloseLibrary(utilitybase)
  57.  
  58. ENDPROC
  59.  
  60. PROC random(gh:PTR TO guihandle)
  61.  
  62.     DEF r
  63.  
  64.     r:=Rnd(101)
  65.  
  66.     bar_1.set(PLA_Bar_Percent, r)
  67.  
  68.     settext(gh, t1, StringF(work, '\d%', r))
  69.  
  70.     r:=Rnd(101)
  71.  
  72.     bar_2.set(PLA_Bar_Percent, r)
  73.  
  74.     settext(gh, t2, StringF(work, '\d%', r))
  75.  
  76.     r:=Rnd(101)
  77.  
  78.     bar_3.set(PLA_Bar_Percent, r)
  79.  
  80.     settext(gh, t3, StringF(work, '\d%', r))
  81.  
  82.     r:=Rnd(101)
  83.  
  84.     bar_4.set(PLA_Bar_Percent, r)
  85.  
  86.     settext(gh, t4, StringF(work, '\d%', r))
  87.  
  88. ENDPROC
  89.  
  90.